package com.zoweunion.mechanic.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;

import com.zoweunion.mechanic.dao.NeedLeaseDao;
import com.zoweunion.mechanic.entity.NeedLeaseEntity;
import com.zoweunion.mechanic.service.NeedLeaseService;


@Service("needLeaseService")
public class NeedLeaseServiceImpl extends ServiceImpl<NeedLeaseDao, NeedLeaseEntity> implements NeedLeaseService {

    @Autowired
    private NeedLeaseDao needLeaseDao;


    @Override
    public PageInfo queryPage(Map<String, Object> map)  {
        Integer pageSize = Integer.valueOf(map.get("pageSize").toString());
        Integer currentPage = Integer.valueOf(map.get("currentPage").toString());
        PageHelper.startPage(currentPage, pageSize);
        List<NeedLeaseEntity> mapList = needLeaseDao.queryPage(map);
        PageInfo<NeedLeaseEntity> mapPageInfo = new PageInfo<>(mapList);
        return mapPageInfo;
    }

    @Override
    public NeedLeaseEntity getInfoById(long id) {

        return needLeaseDao.getInfoById(id);
    }

}